package com.ihr360.payroll.controller.staff;

import com.ihr360.maven.plugin.ModuleCodeStore;
import com.ihr360.maven.plugin.annotation.FunctionDefinition;
import com.ihr360.maven.plugin.annotation.ModuleDefinition;
import com.ihr360.shared.advice.response.DisableResponseAdvice;
import com.ihr360.shared.basicstaffinfo.dao.SyncedStaffInfoRepository;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(value = "员工花名册同步数据相关接口")
@RestController
@RequestMapping("/syncedBasicStaffInfoes")
@ModuleDefinition(mainModuleCode = ModuleCodeStore.Module.SALARY_CODE, mainModuleName = ModuleCodeStore.Module.SALARY_NAME,
        subModuleCode = ModuleCodeStore.Module.Salary.STAFF_PAY_ROLLINFO_CODE, subModuleName = ModuleCodeStore.Module.Salary.STAFF_PAY_ROLLINFO_NAME,
        isPublic = true)
public class SyncedBasicStaffInfoController {

    @Autowired
    SyncedStaffInfoRepository syncedStaffInfoRepository;


    @ApiOperation(value = "获取所有公司Id")
    @GetMapping(value = "/companyIds/list", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @FunctionDefinition(functionName = "获取所有公司Id", functionCode = ModuleCodeStore.Function.VIEW, isPublic = true)
    @DisableResponseAdvice
    public List<String> updateSalaryfile() {
        return syncedStaffInfoRepository.findAllCompanyIds();
    }

}
